﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewsStat.aspx.cs" Inherits="Admin_NewsStat" MasterPageFile="~/Admin/MasterPage.master" %>

<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="MainContent">
<h1>
        <%=sPageTitle %>
    </h1>
   <br />
<div class="RegularBold">Page keywords</div>
<asp:TextBox runat="server" ID="txtKeywords"  Width="500px"></asp:TextBox>
<asp:Button ID="btnAddKeywords" runat="server" Text="Сохранить" OnClick="btnAddKeywords_Click"></asp:Button>
<br />
<img src="images/Delimiter.png" border="0" alt=""><br />

<asp:HyperLink runat="server" ID="lnkTopNews" Text="Top News"></asp:HyperLink>
<h2>Статьи</h2>
    <asp:GridView ID="gvNews" runat="server" AutoGenerateColumns="false" CssClass="SiteStats"
        AllowPaging="true" AlternatingRowStyle-CssClass="SiteStatsA" RowStyle-CssClass="SiteStats"
        Width="98%" AllowSorting="true" OnSorting="gvNews_Sorting" OnRowDataBound="gvNews_DataBinding"
         PagerSettings-Visible="true"  OnPageIndexChanging="gvNews_PageindexChanging"  PageSize="40" >
        <Columns>
            <asp:BoundField DataField="PublishDate" SortExpression="Date" HeaderText="Дата" HeaderStyle-CssClass="StatsHeader"/>
            <asp:BoundField DataField="Title" HeaderText="Статья" SortExpression="Title" HeaderStyle-CssClass="StatsHeader"/>
            <asp:TemplateField HeaderText="Популярная статья" HeaderStyle-CssClass="StatsHeader">
                 <ItemTemplate>
                <asp:CheckBox runat="server" ID="chkPopular" CommandArgument='<%# Eval("ArticleID") %>' AutoPostBack="true" OnCheckedChanged="chkPopular_Changed" Checked='<%# Eval("IsPopular") %>' />
                </ItemTemplate>
                </asp:TemplateField>
            <asp:TemplateField HeaderText="Показывать на сайте" HeaderStyle-CssClass="StatsHeader" >
                <ItemTemplate>
                <asp:CheckBox runat="server" ID="chkVisible" CommandArgument='<%# Eval("ArticleID") %>' AutoPostBack="true" OnCheckedChanged="chkVisible_Changed" Checked='<%# Eval("Isvisible") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Показывать в top" HeaderStyle-CssClass="StatsHeader" >
                <ItemTemplate>
                <asp:CheckBox runat="server" ID="chkTop" CommandArgument='<%# Eval("ArticleID") %>' AutoPostBack="true" OnCheckedChanged="chkTop_Changed" Checked='<%# (Convert.ToInt32(Eval("IsInTop"))>0)?true:false %>' />
                </ItemTemplate>
            </asp:TemplateField>
            
            <asp:BoundField DataField="Views" HeaderText="Просмотров" SortExpression="Views" HeaderStyle-CssClass="StatsHeader"/>
            <asp:TemplateField HeaderText="Действие" HeaderStyle-CssClass="StatsHeader" >
            <ItemTemplate>
               <asp:Button OnCommand="btnDeleteNews_Click" CausesValidation="false" UseSubmitBehavior="false" CommandArgument='<%# Eval("ArticleID") %>'
                    Text='удалить' ID="btnDeleteNews" CssClass="but" runat="server"  />
              <asp:Button OnCommand="btnEditNews_Click" UseSubmitBehavior="false" CommandArgument='<%# Eval("ArticleID") %>'
                    Text="редактировать" runat="server" ID="btnEditNews" CssClass="but" />
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>